#include <stdio.h>
#include<stdlib.h>
//qsort(arr, num, sizeof(int), )

void quick_sort(int q[], int l, int r)
{
	if (l >= r) return;
	int x = q[l], i = l - 1, j = r + 1;
	while (i < j)
	{
		do i++; while (q[i] < x);
		do j--; while (q[j] > x);
		if (i < j)
		{
			int t = q[i];
			q[i] = q[j];
			q[j] = t;
		}
	}
	quick_sort(q, l, j), quick_sort(q, j + 1, r);
}

int upsort(const void* e1, const void* e2)
{
	return *(int*)e1 - *(int*)e2;
}

int downsort(const void* e1, const void* e2)
{
	return -(*(int*)e1 - *(int*)e2);
}

int main()
{
	int arr[] = { 2,3,6,4,8,5,9,3 };
	int num = sizeof(arr) / sizeof(int);
	qsort(arr, num, sizeof(int), downsort);
	for (int i = 0; i <= num-1; i++)
		printf("%d ", arr[i]);
	return 0;
}   